package com.devops.admin.temporal.workflow.impl;

import com.devops.admin.temporal.activity.SyncKafkaTopicActivity;
import com.devops.admin.temporal.workflow.SyncKafkaTopicWorkflow;
import com.devops.constant.DevOpsConstant;
import io.temporal.activity.ActivityOptions;
import io.temporal.spring.boot.WorkflowImpl;
import io.temporal.workflow.Workflow;

import java.time.Duration;

/**
 * @author jxt
 * @Notes
 * @date 2023/5/17 14:04
 */
@WorkflowImpl(taskQueues = DevOpsConstant.SYNC_KAFKA_TOPIC_WORKFLOW_TASK_QUEUE)
public class SyncKafkaTopicWorkflowImpl implements SyncKafkaTopicWorkflow {
    ActivityOptions options = ActivityOptions.newBuilder()
            .setStartToCloseTimeout(Duration.ofHours(1))
            .setHeartbeatTimeout(Duration.ofMinutes(10))
            .build();
    @Override
    public void syncKafkaTopic() {
        SyncKafkaTopicActivity syncKafkaTopicActivity = Workflow.newActivityStub(SyncKafkaTopicActivity.class, options);
        syncKafkaTopicActivity.syncKafkaTopic();
    }
}
